#include<iostream>
using namespace std;

class X
{};

class Y : public virtual X
{};

class Z : public virtual X
{};

class A : public Y, public Z
{};

class S
{
	public:
		int a;
		int b;
};
/*
template<class T, class datatype1, class datatype2>
char* order(datatype1 T::*mem1, datatype2 T::*mem2)
{
	assert(mem1 != mem2);
	return mem1 < mem2 ? "mem1 first" : "mem2 first";
}
*/

class M : public Y, public Z
{};

//////////////////////////////////////////
int main(int argc, char* argv[])
{
	cout << "size of X " << sizeof(X) << endl;
	cout << "size of Y " << sizeof(Y) << endl;
	cout << "size of Z " << sizeof(Z) << endl;
	cout << "size of A " << sizeof(A) << endl;
	cout << "=========================\n";
	//cout << order(&S::a, &S::b) << endl;
	M m;
	M *mptr = &m;
	Y *yptr = mptr;
	Z *zptr = mptr;
	X *xptr = zptr;
	printf("mptr %p\n", mptr);
	printf("yptr %p\n", yptr);
	printf("zptr %p\n", zptr);
	printf("xptr %p\n", xptr);
	cout << "===========================\n";
	printf("&S::a %p\n", &S::a);
	printf("&S::b %p\n", &S::b);
	if(&S::a != 0)
		cout << "&S::a != 0 actually!" << endl;
	S s;
	printf("&s.a %p\n", &s.a);
	int S::*sptr = &S::a;
	printf("S::*sptr %p\n", sptr);
	return 0;
}
